package com.atguigu03.date.exer1;

import org.junit.Test;

import java.util.Date;

/**
 * ClassName: Exer01
 * Package: com.atguigu03.date.exer1
 * Description:
 *
 * @Author ZY
 * @Create 14:41
 * @Version 1.0
 */
public class Exer01 {

    @Test
    public void test1(){
        Date date1 = new Date();

        //错误：不能把Date类型转换成sql.Date类型
//        java.sql.Date date2 = (java.sql.Date) date1;
//        System.out.println(date2);

        //正确：
        java.sql.Date date2 = new java.sql.Date(date1.getTime());
        System.out.println(date2);
    }
}
